<template>
  <a-select placeholder="请选择明细表" v-model="innerValue" allowClear>
    <a-select-option v-for="item in subForms" :key="item.id" :value="item.id">
      {{ item.formName }}
    </a-select-option>/
  </a-select>
</template>
<script>
import {createModelForVue, createProps} from '@/utils';
import {createFormDefinition} from '@comp/hhd/design/FormDesigner/types';

export default {
  name: 'FormCheckSubFormSelector',
  model: createModelForVue(),
  props: {
    value: createProps(String),
    formDefinition: createProps(Object, createFormDefinition),
  },
  computed: {
    subForms() {
      let list = this.formDefinition && this.formDefinition.subForms || [];
      // list = JSON.parse(JSON.stringify(list));
      // this.formDefinition && list.push({
      //   id: this.formDefinition.id,
      //   formName: '主表'
      // })
      return list
    },
    innerValue: {
      get() {
        return this.value
      },
      set(v) {
        this.$emit('change', v);
      }
    }
  }
}
</script>